{
	template:`
	<a-page-header title="编辑" sub-title="汇总链接表">
		<template #extra>
			<a-button type="primary" @click="save();">保存</a-button>
			<m-back @click="back(false);">关闭</m-back>
		</template>
		<a-card :hoverable="true" :bodyStyle="{padding:'20px 20px 0'}">
			<a-form class="index-form" :wrapper-col="{span:24}">
				<a-row :gutter="10">
					<a-col :span="16">
						<a-form-item label="链接类型" class="index-form-item">
							<a-radio-group :options="dictOptions('api.model.ApiCollectJoin!joinType')" v-model:value="model.joinType" />
						</a-form-item>
					</a-col>
					<a-col :span="8">
						<a-form-item label="排序" class="index-form-item">
                            <a-input-number v-model:value="model.sort" placeholder="请输入序号" style="width:100%"/>
						</a-form-item>
					</a-col>
					<a-col :span="8">
						<a-form-item label="来源" class="index-form-item">
							<a-radio-group :options="dictOptions('api.model.ApiCollectJoin!source')" v-model:value="model.source"/>
						</a-form-item>
					</a-col>
					<a-col v-if="model.source=='table'" :span="8">
						<a-form-item label="数据表" class="index-form-item">
							<a-select :options="tableList" v-model:value="model.table.oid" placeholder="请选择数据表" show-search :filter-option="selectFilter" />
						</a-form-item>
					</a-col>
					<a-col v-if="model.source=='collect'" :span="8">
						<a-form-item label="汇总表" class="index-form-item">
							<a-select :options="collectList" v-model:value="model.collect.oid" placeholder="请选择汇总表" show-search :filter-option="selectFilter" />
						</a-form-item>
					</a-col>
					<a-col :span="8">
						<a-form-item label="别名" class="index-form-item">
                            <a-tooltip title="只能输入小写字母数字和下划线">
                                <a-input v-model:value="model.alias" placeholder="请输入别名"/>
                            </a-tooltip>
						</a-form-item>
					</a-col>
					<a-col :span="24">
						<a-form-item class="index-form-item-no">
					        <a-alert message="保存后再设置链接条件，字段参数可选择链接表。" type="info" />
						</a-form-item>
					</a-col>
					<a-col :span="24">
						<a-form-item label="链接条件" class="index-form-item">
						    <a-button type="primary" @click="inputTestField()">输入</a-button>
                            {{model.joinOn}}
						</a-form-item>
					</a-col>
				</a-row>
			</a-form>
		</a-card>
	</a-page-header>
	`,
	props: ['localeZh','param','parentVue'],
	data:function(){
		return {
		    model:{table:{},collect:{}},
		    tableList:[],
		    collectList:[]
		};
	},
	mounted(){
	    this.model=this.param.model;
	    this.tableList=this.param.tableList;
	    this.collectList=this.param.collectList;
	},
	methods:{
		save:function(){
			this.requestData('action/api/apiCollect/doSaveJoin',
				{join:this.model},
				data=>{
					if(data.code==0){
						this.$message.success(data.msg);
						this.model=data.model;
						if(this.model.joinOn){
						    this.back(true);
						}else{
						    this.setBack(true);
						}
					}else{
						this.$message.error(data.msg);
					}
				}
			);
		},
		inputTestField:function(){
            this.openPage('page/base/api/inputTestField.js',
                {value:this.model.joinOn,collectOid:this.model.apiCollect.oid,
                    temps:["#{字段}=#{字段}","#{字段}=#{字段} and #{字段}=#{字段}","#{字段}=#{字段} or #{字段}=#{字段}"]},
                function(flag,obj){
                    if(flag){
                        this.model.joinOn=obj;
                    }
                },
                "800px"
            );
		}
	}
}